<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>消息回复--layui后台管理模板</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<link rel="stylesheet" href="../../js/layui/css/layui.css"
	media="all" />
    <script src="../../js/layui/layui.js"></script>
	<link rel="stylesheet" href="../../css/font_eolqem241z66flxr.css" media="all" />
	<link rel="stylesheet" href="../../css/message.css" media="all" />
	<style type="text/css">
	#ly input{
	border: 0px;
	}
	</style>
</head>
<body class="childrenBody">
	<form class="layui-form" id="LyForm" lay-filter="LyForm" onsubmit="return false;">
	<input type="hidden" name="id" />
		<div class="layui-form-item">
			<label class="layui-form-label">姓名</label>
			<div class="layui-input-inline">
				<input type="text" class="layui-input " name="cmtId" readonly="readonly">
			</div>
			<label class="layui-form-label">用户名</label>
			<div class="layui-input-inline">
				<input type="text" class="layui-input " name="vId" readonly="readonly" >
			</div>
		</div>
	
		<div class="layui-form-item">
			<label class="layui-form-label">评价内容</label>
			<div class="layui-input-inline">
				<input type="text" class="layui-input " name="cmtTest" readonly="readonly"style="height: 100px;width: 500px">
			</div>
			</div>
			<label class="layui-form-label">评价星级</label>
			<div class="layui-input-inline">
				<input type="text" class="layui-input " name="lv" readonly="readonly" >
			</div>
	
		<div class="layui-form-item">
			<label class="layui-form-label">评价时间</label>
			<div class="layui-input-inline">
				<textarea  class="layui-input " name="cmtTime" readonly="readonly" ></textarea>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">所属商品</label>
			<div class="layui-input-inline">
				<textarea  class="layui-input "  name="pdtId" readonly="readonly" ></textarea>
			</div>
		</div>
	</form>
		<form class="layui-form" id="hfForm" lay-filter="hfForm">
	<input type="hidden" name="cmtId" /> 
		<div class="layui-form-item">
			<label class="layui-form-label">回复内容</label>
			<div class="layui-input-block">
				<textarea class="layui-input" name="cmtContent" lay-verify="required" placeholder="请输入回复内容"style="height: 100px;width: 500px"></textarea>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">回复时间</label>
			<div class="layui-input-inline">
				<textarea  class="layui-input "  name="cmtReplyTime" readonly="readonly" ></textarea>
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-input-block">
				<button class="layui-btn" lay-submit="" lay-filter="addNews">发送</button>
				<button type="reset" class="layui-btn layui-btn-primary">重置</button>
		    </div>
		</div>
	</form>
	
	<script type="text/javascript">
		layui.use([ 'upload', 'layer' ,'form','laydate'], function() {
			var upload = layui.upload, $ = layui.$,form=layui.form, layer = layui.layer,laydate=layui.laydate;
            var data=JSON.parse(sessionStorage.getItem("message")); //存放数据，修改时用
			
			form.val("LyForm",{
				"cmtId":data.cmtId,
				"vId":data.vId,
				"cmtTest":data.cmtTest,
				"lv":data.lv,
				"cmtTime":data.cmtTime,
				"pdtId":data.pdtId,
			});
			form.val("hfForm",{
				"cmtContent":data.cmtContent,
				"cmtReplyTime":data.cmtReplyTime,
				"cmtId":data.cmtId,
			});
			form.render();
			
			form.on('submit(addNews)',function(data){
				$.post(
						'http://localhost:8080/Greenleaf/comment/update',
								$("#hfForm").serialize(),function(res){
							if (res) {
								
								var index = top.layer.msg('数据提交中，请稍候',{icon: 16,time:false,shade:0.8});
						        setTimeout(function(){
						            top.layer.close(index);
									top.layer.msg("回复成功！");
						 			layer.closeAll("iframe");
							 		//刷新父页面
							 		parent.location.reload();
						        },1000);
							}
						},"text"
				)
				return false;
			})
		});
		</script>
</body>
</html>